Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
oniyi-logger
Advanced tools
A simple loglevel and label wrapper around process.stdout
$ npm install --save oniyi-logger
all log functions work similar to console.log() and can take multiple arguments in a printf()-like way. Note that the debug()
method is a noop per default. To enable debug()
logging, you must use a labled logger, and list the label in the NODE_DEBUG
environment variable. NODE_DEBUG
must be a comma,
or space
separated list
var fs = require('fs');
// standard use-case, will log to process.stdout
var logger = require('oniyi-logger')('my-awesome-module');
logger.info('my %s message', 'info');
// INFO [my-awesome-module] my info message
logger.debug('my debug message');
// Does not log anything
logger.warn('my warn message');
// WARN [my-awesome-module] my warn message
logger.error('my error message');
// ERROR [my-awesome-module] my error message
// log to a file
var labeledFileLog = require('oniyi-logger')('file', {sink: fs.createWriteStream('file.log, {flags: 'a'}')});
labeledFileLog.info('my info message');
// writes "INFO [file] my info message" to file.log
labeledFileLog.debug('my debug message');
// writes does not write anything to file.log
labeledFileLog.warn('my warn message');
// writes "WARN [file] my warn message" to file.log
labeledFileLog.error('my error message');
// writes "ERROR [file] my wrror message" to file.log
You can use nested lables to controle debug messages with finer granularity.
so with process.env.NODE_DEBUG = 'foo:bar'
, you get this:
const oniyiLogger = require('oniyi-logger');
const fooLogger = oniyiLogger('foo');
const barLogger = oniyiLogger('foo:bar');
fooLogger.debug('my debug message');
// Does not log anything
barLogger.debug('my debug message');
// DEBUG [foo:bar] my debug message
and with process.env.NODE_DEBUG = 'foo:*'
, you get this:
const oniyiLogger = require('oniyi-logger');
const fooLogger = oniyiLogger('foo');
const barLogger = oniyiLogger('foo:bar');
fooLogger.debug('my debug message');
// DEBUG [foo] my debug message
barLogger.debug('my debug message');
// DEBUG [foo:bar] my debug message
Apache 2.0 © Benjamin Kroeger
FAQs
A simple loglevel and label wrapper around process.stdout
The npm package oniyi-logger receives a total of 45 weekly downloads. As such, oniyi-logger popularity was classified as not popular.
We found that oniyi-logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.